import os
import re
import sys
import subprocess
try:
    from mgamedev.py_utils import kill_process
except ImportError as ie:
    print("try to install <%s>" % "mgamedev")
    ret = os.system("pip install mgamedev")
    if (ret == 0):
        print("install suc!")
    else:
        print("install plugin failed!")
        exit()

__all__ = [
    "execute"
]


def execute():
    if sys.platform == "win32":
        cmd_str = "taskkill /f /im nginx.exe"
        subprocess.call(cmd_str, shell=True)
    else:
        kill_process.kill_process("nginx")
        kill_process.kill_process("openresty")


if __name__ == "__main__":
    execute()